<template>
    <d2-container>
        <template slot="header">
            <el-form :inline="true" :model="searchForm" ref="searchForm" size="mini" style="margin-bottom: -18px;">
                <el-form-item label="名称" prop="name">
                    <el-input v-model="searchForm.name" placeholder="名称" style="width: 120px;" />
                </el-form-item>
                <el-form-item>
                    <el-button type="primary" @click="handleSearchFormSubmit">
                        <d2-icon name="search" /> 查询
                    </el-button>
                </el-form-item>
                <el-form-item>
                    <el-button @click="handleSearchFormReset">
                        <d2-icon name="refresh" /> 重置
                    </el-button>
                </el-form-item>
            </el-form>
        </template>
        <d2-tree-crud ref="d2Crud" :columns="columns" :data="data" :options="options" :form-options="formOptions"
            :add-template="template" :edit-template="template" :add-rules="rules" :edit-rules="rules"
            @selection-change="handleSelectionChange" @dialog-cancel="handleDialogCancel" @row-add="handleRowAdd"
            @row-edit="handleRowEdit" selection-row>
            <el-button slot="header" style="margin-bottom: 5px" type="primary" size="mini" icon="el-icon-circle-plus"
                @click="add">
                新增
            </el-button>
            <el-button slot="header" style="margin-bottom: 5px" size="mini" icon="el-icon-edit" @click="edit">
                修改
            </el-button>
            <el-button slot="header" style="margin-bottom: 5px" type="danger" size="mini" icon="el-icon-delete" @click="batchDelete">
                删除
            </el-button>
        </d2-tree-crud>
    </d2-container>
</template>

<script>
    import crud from "@/pages/components/crud/crud";
    import defaultStyle from "@/pages/components/crud/defaultStyle";
    import config from "./config";
    export default {
        mixins: [crud, defaultStyle, config],
    }
</script>
